package cn.com.service.impl.cs;

import static cn.com.support.message.MessageCodeEnum.ERROR_SELECT;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.commons.Paginator;
import cn.com.dal.dao.cs.SummaryDAO;
import cn.com.dal.dataobject.cs.SummaryDO;
import cn.com.service.cs.SummaryService;

@Service
public class SummaryServiceImpl implements SummaryService {

	private Logger logger = LoggerFactory.getLogger(ProjectServiceImpl.class);

	@Autowired
	private SummaryDAO<SummaryDO> summaryDAO;

	@Override
	public <C> Paginator<C, List<SummaryDO>> selectByPage(
			Paginator<C, List<SummaryDO>> paginator) {
		Paginator<C, List<SummaryDO>> result = null;
		try {
			result = summaryDAO.selectForPage(paginator);
		} catch (Exception e) {
			logger.error(
					String.format(ERROR_SELECT.descript() + ":[%s]",
							paginator.getCondition()), e);
		}
		return result;
	}
	
	@Override
	public List<SummaryDO> selectList(Map<Object, Object> params) {
		List<SummaryDO> result = null;
		try {
			result = summaryDAO.selectList(params);
		} catch (Exception e) {
			logger.error(String.format(ERROR_SELECT.descript() + ":[%s]"), e);
		}
		return result;
	}
}
